<?php
class Admin_Form_Resource extends Zend_Form
{
    public function init()
    {
        $this->setName("admin");

        $resourceId = new Zend_Form_Element_Hidden('resourceId');
        $resourceId->addFilter('Int');
        
        $resourceName = new Zend_Form_Element_Text('resourceName');
        $resourceName->setLabel('Tên Resource')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $resourceName->setAttrib('size', 60);
        
        $moduleName = new Zend_Form_Element_Text('moduleName');
        $moduleName->setLabel('Module Name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $moduleName->setAttrib('size', 30);
        
        $controllerName = new Zend_Form_Element_Text('controllerName');
        $controllerName->setLabel('Controller Name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $controllerName->setAttrib('size', 30);
        
        $actionName = new Zend_Form_Element_Text('actionName');
        $actionName->setLabel('Action Name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $actionName->setAttrib('size', 30); 
        
        $menu = new Zend_Form_Element_Text('menu');
        $menu->setLabel('Menu');                
        $menu->setAttrib('size', 60)->setAttrib('disabled','');                                      
        
        $detail = new Zend_Form_Element_Textarea('detail');
        $detail->setLabel('Mô tả');
        $detail->setAttrib('rows', 8);
        
        $ord = new Zend_Form_Element_Text('ord');
        $ord->setLabel('Thứ tự')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('Int')->addValidator('NotEmpty');
        $ord->setAttrib('size', 10);

        // submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id','submitbutton');
        $submit->setAttrib('class',"button medium");
                
        // add elements to form
        $this->addElements(array (
            $resourceId, $resourceName, $moduleName, $controllerName, $actionName, $menu, $detail, $ord, $submit
        ));
    }
}

